/**
 * 
 */
package uy.com.pzit.fpmundialmodel.service;

import uy.com.pzit.fpmundialmodel.domain.Pais;
import uy.com.pzit.fpmundialmodel.manager.PaisManager;
import uy.com.pzit.fpmundialmodel.response.PaisResponse;
import uy.com.pzit.fpmundialmodel.web.ModelContextServlet;
import uy.com.pzit.fpmundialmodel.web.ws.PaisService;

/**
 * @author pferraz
 *
 */
public class PaisServiceImpl implements PaisService {

	private PaisManager paisManager;
	
	@Override
	public Pais addPais(Pais pais) {
		return getManager().addPais(pais);
	}

	@Override
	public PaisResponse getPaisById(Integer id) {
			
		return getManager().getPaisById(id);
	}

	@Override
	public PaisResponse getPaises() {
				
		return getManager().getPaises();
	}

	@Override
	public PaisResponse getPaisByNombre(String nombre) {
		return getManager().getPaisByNombre(nombre);
	}
	
	@Override
	public PaisResponse getPaisesOrderByRanking() {
		return getManager().getPaisesOrderByRanking();
	}
	
	
	private PaisManager getManager() {
		if(this.paisManager==null)
			this.paisManager=(PaisManager)ModelContextServlet.getSpringContext().getBean("paisManager");
		return this.paisManager;
	}

	
}
